﻿using Microsoft.WindowsAzure.ServiceRuntime;
using Newtonsoft.Json.Linq;
using ShoppingCart.WebApi.Models;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;

namespace ShoppingCart.WebApi.DataLayer
{
    public class DataHelper
    {
        public static string GetConfigurationSetting(string configName)
        {
            if (RoleEnvironment.IsAvailable)
                return RoleEnvironment.GetConfigurationSettingValue(configName);

            else
                return ConfigurationManager.AppSettings[configName];
        }

        //public static JObject ToJObject(this ShoppingCartModel shoppingcart)
        //{
        //    var jobject = JObject.FromObject(shoppingcart);

        //    // Add something just to illustrate we're not returning the model
        //    jobject.Add("TimeStamp", DateTime.UtcNow);
        //    return jobject;
        //}
    }
}